package com.hzlj.position.job.job;

import com.fz.common.redis.annotation.SyncLock;
import com.hzlj.position.locate.service.AbnNightActivityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * job 建议凌晨1点开始执行
 **/
@Slf4j
@Component
public class AbnNightActivityJob {
    @Resource
    private AbnNightActivityService abnNightActivityService;

    @SyncLock(lockMs = 60000)
    @Scheduled(cron = "${job.abn.night-activity:-}")
    public void analysis() {
        long start = System.currentTimeMillis();
        log.info("任务开始执行[夜间活动]");
        abnNightActivityService.abn();
        log.info("任务结束执行[夜间活动],cost={}", System.currentTimeMillis() - start);
    }

}
